import { createRouter, createWebHashHistory } from "vue-router";
import routes from './routes';
//创建路由实例
const router = createRouter({
    //管理路由的历史记录
    history:createWebHashHistory(),
    routes:[...routes]
});
router.beforeEach((to,from,next)=>{
    if(!localStorage.token&&to.path !=='/login'){
        return next('/login');
    }
    next();
})
export default router;